<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('用户分配角色')" />
</head>
<body>
<div class="main-content">
	<form id="form-user-add" class="form-horizontal">
		<input type="hidden" id="userId" name="userId" th:value="${user.userId}">
		<input type="hidden" id="loginName" name="loginName" th:value="${user.loginName}">
		<table class="table table-hover">
			<thead>
			<tr>
				<th class="bs-checkbox " style="width: 36px; " data-field="0" tabindex="0">
					<div class="th-inner "></div>
				</th>
				<th data-field="channnelCode" tabindex="0"><div class="th-inner ">通道编码</div><div class="fht-cell"></div></th>
				<th data-field="channnelName" tabindex="0"><div class="th-inner ">通道名称</div><div class="fht-cell"></div></th>
				<th data-field="userChannelRate1" tabindex="0"><div class="th-inner ">出金费率</div><div class="fht-cell"></div></th>
				<th data-field="userChannelFee" tabindex="0"><div class="th-inner ">额外收取手续费</div><div class="fht-cell"></div></th>
			</tr>
			</thead>
			<tbody>
				<tr th:each="channel : ${sysChannelOuts}">
					<td>
						<input type="radio" name="channelRadios" th:value="${channel.channelOutId}"  th:checked="${sysUserChannelOut.channelOutId}==${channel.channelOutId}">
					</td>
					<td th:text="${channel.channelOutCode}"></td>
					<td th:text="${channel.channelOutName}"></td>
					<td><input id="userChannelRate1" th:field="${sysUserChannelOut.userChannelRate1}" style="width: 50px;text-align: center"/></td>
					<td><input id="userChannelFee" th:field="${sysUserChannelOut.userChannelFee}" style="width: 50px;text-align: center"/></td>
				</tr>
			</tbody>
		</table>


	</form>
</div>

<th:block th:include="include :: footer" />
<script th:inline="javascript">
	var prefix = ctx + "system/user";
	var userRoles = [[${userRoles}]]


	/* 修改apikey-提交 */
	function submitHandler(index, layero){
		// var rows = $.table.selectFirstColumns();
		var userChannelRate1= $('input:radio[name="channelRadios"]:checked').parent().next().next().next().children("input").val();
		var userChannelFee= $('input:radio[name="channelRadios"]:checked').parent().next().next().next().next().children("input").val();
		var data = { "userId": $("#userId").val(), "channelOutId": $('input:radio[name="channelRadios"]:checked').val(),"userChannelRate1": userChannelRate1,"userChannelFee": userChannelFee};
		$.ajax({
			type: "POST",
			url: prefix + '/editUserChannelOut' ,
			data: data ,
			async: false,
			success: function (data) {
				if (data.code==0) {
					$.modal.confirm("操作成功;是否退出此页面", function () {
						var index = parent.layer.getFrameIndex(window.name);
						$.modal.close(index);
					});
				}else {
					$.modal.msgError(data.msg);
				}
			},
			error: function () {
				$.modal.msgError("未知错误,请重试");
			}
		})
	}


</script>
</body>
</html>